﻿package org.xhs.report.doc.ui
{
    import flash.display.*;

    public class BlankPage extends Sprite
    {
        protected var _hasLoaded:Boolean = false;
        protected var _pageWidth:Number = 400;
        protected var _pageHeight:Number = 300;
        protected var _pageth:int;
        protected var pageContainer:Sprite;
        protected var pageLoading:MovieClip;

        public function BlankPage()
        {
            this.pageContainer = new Sprite();
            addChild(this.pageContainer);
            return;
        }// end function

        protected function initPageLoading() : void
        {
            if (!this.pageLoading)
            {
                this.pageLoading = new PageLoading();
                this.pageLoading.scaleX = this.pageLoading.scaleX / (3 / 2);
                this.pageLoading.scaleY = this.pageLoading.scaleY / (3 / 2);
            }
            this.pageLoading.x = this._pageWidth / 2;
            this.pageLoading.y = this._pageHeight / 2;
            this.pageLoading.stop();
            this.pageContainer.addChild(this.pageLoading);
            return;
        }// end function

        public function set pageth(param1:int) : void
        {
            if (param1)
            {
                this._pageth = param1;
            }
            return;
        }// end function

        public function get pageth() : int
        {
            return this._pageth || 0;
        }// end function

        public function setSize(param1:Number, param2:Number, param3:Boolean = false) : void
        {
            if (param1 <= 0 || param2 <= 0)
            {
                return;
            }
            this._pageWidth = param1;
            this._pageHeight = param2;
            var _loc_4:* = this.pageContainer.graphics;
            this.pageContainer.graphics.clear();
            _loc_4.lineStyle(1, 12111302);
            _loc_4.beginFill(16645629, 1);
            _loc_4.drawRect(0, 0, this._pageWidth, this._pageHeight);
            _loc_4.endFill();
            if (param3)
            {
                this.initPageLoading();
            }
            return;
        }// end function

        public function clearChildren() : void
        {
            var _loc_1:DisplayObject = null;
            var _loc_2:* = numChildren;
            while (--_loc_2 > -1)
            {
                
                _loc_1 = getChildAt(0);
                removeChild(_loc_1);
                _loc_1 = null;
            }
            this._hasLoaded = true;
            return;
        }// end function

        public function showLoading() : void
        {
            this.initPageLoading();
            this.pageLoading.play();
            return;
        }// end function

        public function hideLoading() : void
        {
            if (this.pageLoading)
            {
                this.pageLoading.stop();
                if (this.pageContainer.contains(this.pageLoading))
                {
                    this.pageContainer.removeChild(this.pageLoading);
                }
                this.pageLoading = null;
            }
            return;
        }// end function

    }
}
